package com.x_memteor.base_master.utils;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

/**
 * @author: X_Meteor
 * @description: 类描述
 * @version: V_1.0.0
 * @date: 2017/7/10 21:51
 * @company:
 * @email: lx802315@163.com
 */
public class RecycleViewUtils {

    /**
     * 设置简单分割线的垂直管理器
     *
     * @param context
     * @param recyclerView
     */
    public static void getVerticalLayoutManager(Context context, RecyclerView recyclerView) {

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
        layoutManager.setAutoMeasureEnabled(true);
        recyclerView.setLayoutManager(layoutManager);
//        recyclerView.addItemDecoration(new SimpleDicider());
    }

    /**
     * 设置简单分割线的水平管理器
     *
     * @param context
     * @param recyclerView
     */
    public static void getHorizontalLayoutManager(Context context, RecyclerView recyclerView) {

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
        recyclerView.setLayoutManager(layoutManager);
    }

    /**
     * 设置简单分割线的水平管理器
     *
     * @param context
     * @param recyclerView
     */
    public static void getGridLayoutManager(Context context, RecyclerView recyclerView) {

        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(context, 3, GridLayoutManager.VERTICAL, false);
        recyclerView.setLayoutManager(layoutManager);
    }

    /**
     * 设置简单分割线的水平管理器
     *
     * @param context
     * @param recyclerView
     */
    public static void getGridLayoutManager(Context context, RecyclerView recyclerView, int spanCount) {

        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(context, spanCount, GridLayoutManager.VERTICAL, false);
        recyclerView.setLayoutManager(layoutManager);
    }
}
